//
//  SWAddresseeInfoFetchReq.swift
//  ChildStory
//  获取收件人信息
//  Created by linhan on 2017/1/18.
//  Copyright © 2017年 Aiya. All rights reserved.
//

import Foundation
class SWAddresseeInfoFetchReq: SWBaseRequest
{
    var id:String = ""
    
    override init()
    {
        super.init()
        api = SWRequestAPI.AddresseeInfoFetch
    }
    
    override var url:String
    {
        return "http://mpic.bbyiya.com/user/getUserAddress"
    }
    
    override var params:Any?
    {
        return ["addrid":id]
    }
    
    override func JSONToModel(_ json:JSON, JSONString:String, JSONData:Data) -> AnyObject?
    {
        //trace(json)
        return Mapper<SWAddresseeInfoFetchRsp>().map(JSONString: JSONString)
    }
}

class SWAddresseeInfoFetchRsp: NSObject,Mappable
{
    var statu:String?
    var info:SWAddresseeInfoRsp?
    
    
    required init?(map: Map) { }
    
    // Mappable
    func mapping(map: Map) {
        statu                   <- map["Statu"]
        info                    <- map["BaseModle"]
    }
}

class SWAddresseeInfoRsp: NSObject,Mappable
{
    var id:Int?
    var receiver:String?
    var provinceCode:Int?
    var provinceName:String?
    var cityCode:Int?
    var cityName:String?
    var districtCode:Int?
    var districtName:String?
    var phone:String?
    var postcode:String?
    var block:String?
    
    
    required init?(map: Map) { }
    
    // Mappable
    func mapping(map: Map) {
        id                      <- map["addrid"]
        receiver                <- map["reciver"]
        provinceCode            <- map["province"]
        provinceName            <- map["provinceName"]
        cityCode                <- map["city"]
        cityName                <- map["cityName"]
        districtCode            <- map["area"]
        districtName            <- map["areaName"]
        phone                   <- map["phone"]
        postcode                <- map["postcode"]
        block                   <- map["streetdetail"]
    }
}

